import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

import Layout from '@/layout'

export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('@/view/home')

      }
    ]
  },

  {
    path: '/404',
    component: () => import('@/view/404')
  },
  {
    path: '*',
    redirect: '/home'
  }
]

const createRouter = () => new Router({
  mode: 'history',

  routes: constantRoutes
})

const router = createRouter()

export default router
